﻿using ITSM.Model.Model;
using ITSM.Service;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace ITSM.Controllers.Company
{
    [Route("api/[controller]")]
    [ApiController]
    public class SetCompanyController : ControllerBase
    {
        private readonly ICompany _company;
        public SetCompanyController(ICompany company)
        {
            _company = company;
        }
        [HttpGet]
        public IActionResult QueryCompany() {
            return Ok(_company.QueryCompany());
        }

        [HttpPut]
        public IActionResult PutCompany(RYD_UserCompany company)
        {
            if (string.IsNullOrWhiteSpace(company.RYD_UserId))
            {
                return NotFound();
            }
            return Ok(_company.SetCompany(company));
        }
    }
}
